package com.easylinkin.linkappapi.openapi.controller;

import java.io.UnsupportedEncodingException;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.easylinkin.linkappapi.openapi.service.impl.OpenApiEasyvService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping({"/datavVisual"})
@Api(value="DataPushController",tags={"datapush控制器"})
public class DataVController {
	
	@Resource
    private OpenApiEasyvService openApiService;

	/**
     * 2d可视化数据
     * @param token
     * @return
     * @throws UnsupportedEncodingException
     */
    @ApiOperation("2d可视化数据")
	@GetMapping("/{token}")
    public JSONObject get(@PathVariable("token") String token) throws UnsupportedEncodingException {
        JSONObject parseObject = openApiService.get2dData(token);
        return parseObject;
    }
    /**
     * 更新2d可视化数据
     * @param data
     * @return
     * @throws UnsupportedEncodingException
     */
    @ApiOperation("更新2d可视化数据")
	@PostMapping("/update")
    public JSONObject update2dData(@RequestBody JSONObject data) throws UnsupportedEncodingException {
        JSONObject parseObject = openApiService.update2dData(data);
        return parseObject;
    }

}
